home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Games: Greatest Hits 1996
/
Amiga Games: Greatest Hits 1996.iso
/
archive
/
userbox
/
publicdomain
/
addicon.lha
/
AddIcon
/
AddIcon.s
< prev
next >
Wrap
Text File
|
1996-03-01
|
5KB
|
285 lines
;*************************************
;* *
;* program: AddIcon *
;* author: ScoTT/Inferno & S2B *
;* (Marcin Ochocki) *
;* version: 1.1 *
;* date: 25.04.96 *
;* short: this is small but useful *
;* DOS command to adding *
;* icons to your files, *
;* dirs or devs. *
;* greetz: all Inferno and blabla *
;* members and all my *
;* friends !!! *
;* *
;*************************************
Start
;--------------------------- skopiowanie parametrów pod etykiety
move.l d0,d5
movea.l a0,a5
subq.l #1,d5
beq usage
cmp.b #'"',(a5)
beq cudzyslow
lea filename,a4
copy_filename
move.b (a5)+,(a4)+
cmp.b #$0a,(a5)
beq usage
cmp.b #$20,(a5)
bne copy_filename
move.b #0,(a4)
addi #1,a5
cmp.b #$0a,(a5)
beq usage
lea icon_name,a4
bra copy_iconname
cudzyslow
lea filename,a4
addi #1,a5
copy_filename2
move.b (a5)+,(a4)+
cmp.b #$0a,(a5)
beq usage
cmp.b #'"',(a5)
bne copy_filename2
cmp.b #'"',1(a5)
bne dalej
addi #2,a5
cmp.b #':',(a4)
beq copy_filename2
move.b #'/',(a4)+
bra copy_filename2
dalej
move.b #0,(a4)
addi #2,a5
cmp.b #$0a,(a5)
beq usage
lea icon_name,a4
copy_iconname
move.b (a5)+,(a4)+
cmp.b #$0a,(a5)
bne copy_iconname
lea file_icon,a5
copy_info
move.b (a5)+,(a4)+
cmp.b #0,(a5)
bne copy_info
move.b #0,(a4)
;--------------------------- otwieramy dos.library
move.l 4,a6
lea dosname,a1
clr.l d0
jsr -552(a6) ;OpenLibrary
tst.l d0
beq exit2dos
move.l d0,dosbase
;--------------------------- czy plik/katalog istnieje?
move.l dosbase,a6
move.l #filename,d1
move.l #-2,d2
jsr -84(a6)
tst.l d0
beq close_lib ;zîa nazwa pliku/katalogu
move.l d0,d1
jsr -90(a6)
;--------------------------- sprawdzamy czy plik istnieje
open_file
move.l #filename,d1
move.l #$3ed,d2
jsr -30(a6)
tst.l d0 ; istnieje?
bne close
;--------------------------- jeôli to nie plik to albo katalog albo urzâdzenie
lea filename,a4
search cmp.b #0,(a4)+
bne search
subi #2,a4
cmp.b #':',(a4)
bne katalog
move.l #2,dest_type
bra open_icon_file
katalog
move.l #1,dest_type
close
move.l dosbase,a6
move.l d0,d1
jsr -36(a6)
;--------------------------- otwieramy plik z ikonâ
open_icon_file
move.l dosbase,a6
move.l #icon_patch,d1
move.l #$3ed,d2
jsr -30(a6)
tst.l d0
beq close_lib
move.l d0,iconhandle
;--------------------------- jaki dîugi plik z ikonâ
move.l iconhandle,d1
clr.l d2
moveq.l #1,d3 ;offset_end
jsr -66(a6) ;Seek
move.l iconhandle,d1
clr.l d2
moveq.l #-1,d3 ;offset_beginning
jsr -66(a6) ;Seek
move.l d0,icon_length
;--------------------------- alokacja pamiëci
move.l 4,a6
move.l icon_length,d0
move.l #$10001,d1
jsr -198(a6)
tst.l d0
beq close_file
move.l d0,membase
;--------------------------- wczytanie ikony (pliku) do pamiëci
move.l iconhandle,d1
move.l membase,d2
move.l icon_length,d3
move.l dosbase,a6
jsr -42(a6) ;read
tst.l d0
beq close_file
move.l dosbase,a6 ;zamykamy plik
move.l iconhandle,d1
jsr -36(a6)
;--------------------------- otwieramy plik do zapisu ikony
lea filename,a4
lea dest_filename,a5
copy_name
move.b (a4)+,(a5)+
cmp.b #0,(a4)
bne copy_name
move.l dest_type,d1
cmp.l #2,d1
beq dev
cmp.l #1,d1
beq kat
lea file_icon,a4
copy_icon_file
move.b (a4)+,(a5)+
cmp.b #0,(a4)
bne copy_icon_file
bra open_dest_file
kat
lea file_icon,a4
subi #1,a5
cmp.b #'/',(a5)
beq copy_icon_dir
addi #1,a5
copy_icon_dir
move.b (a4)+,(a5)+
cmp.b #0,(a4)
bne copy_icon_dir
bra open_dest_file
dev
lea dev_icon,a4
copy_icon_dev
move.b (a4)+,(a5)+
cmp.b #0,(a4)
bne copy_icon_dev
open_dest_file
move.l dosbase,a6
move.l #dest_filename,d1
move.l #$3ee,d2
jsr -30(a6)
tst.l d0
beq free_mem
move.l d0,dest_iconhandle
;--------------------------- zapisujemy ikonë w miejscu przeznaczenia
move.l dest_iconhandle,d1
move.l membase,d2
move.l icon_length,d3
jsr -48(a6) ;Write
;--------------------------- zamykamy plik z ikonâ
close_file
move.l dosbase,a6
move.l dest_iconhandle,d1
jsr -36(a6)
;--------------------------- zwalniamy pamiëê
free_mem
move.l 4,a6
move.l membase,a1
move.l icon_length,d0
jsr -210(a6)
clr.l d0
bra close_lib
;--------------------------- okienko z "instrukcjâ"
usage
move.l 4,a6
lea dosname(pc),a1
clr.l d0
jsr -552(a6) ;OpenLibrary
tst.l d0
beq exit2dos
move.l d0,dosbase
move.l dosbase,a6
jsr -60(a6)
move.l d0,windowbase
move.l #stext,d2 ;druk tekstu
move.l #etext-stext,d3
move.l dosbase,a6
move.l windowbase,d1
jsr -48(a6)
;--------------------------- zamykamy dos.library
close_lib
move.l 4,a6
move.l dosbase,a1
move.l 4,a6
jsr -414(a6) ;CloseLibrary
exit2dos
clr.l d0
rts
;--------------------------- trochë danych
filename blk.b 200,0
dest_filename blk.b 200,0
dosname dc.b 'dos.library',0
dosbase dc.l 0
iconhandle dc.l 0
dest_iconhandle
dc.l 0
icon_length dc.l 0
membase dc.l 0
icon_patch dc.b 'icons:'
icon_name blk.b 200,0
file_icon dc.b '.info',0
dev_icon dc.b 'Disk.info',0
windowbase dc.l 0
dest_type dc.l 0
stext
dc.b $0a,$1b,'[33mAddIcon 1.1',$1b,'[0m (c) 1996 by'
dc.b ' ScoTT/Inferno & S2B'
dc.b $0A
dc.b 'Usage AddIcon filename iconname (wichout patch'
dc.b " and '.info')",$0A,$0A
etext